package com.bdqn.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 27435
 * @Date 2024/12/3014:43
 * @Version 1.0
 */

@Controller
@RequestMapping("/account")
@ResponseBody
public class AccountController {

//    @RequestMapping(value = "/account", method = RequestMethod.POST)
//    @ResponseBody
    @PostMapping
    public String addAccount(){
        return "add account";
    }

//    @RequestMapping(value = "/account", method = RequestMethod.GET)
//    @ResponseBody
    // 将路径上的id的值 赋值给形参 id
    @GetMapping("/{id}/{name}")
    public String getAccount(@PathVariable("id") Integer id, @PathVariable("name") String name){
        System.out.println(name);
        return "get account " + id;
    }

//    @RequestMapping(value = "/account", method = RequestMethod.PUT)
//    @ResponseBody
    @PutMapping
    public String updateAccount(){
        return "update account";
    }

//    @RequestMapping(value = "/account", method = RequestMethod.DELETE)
//    @ResponseBody
    @DeleteMapping
    public String delAccount(Integer id){
        return "del account" + id;
    }

}
